package com.yzmoney.common.web.springmvc.interceptor;
import com.yzmoney.common.constant.Constants;
import com.yzmoney.common.web.util.WebUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by LiuJun on 2015/7/17.
 */
public class RequestInterceptor extends HandlerInterceptorAdapter {
    private static final Log log = LogFactory.getLog(RequestInterceptor.class);

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
       String ip=WebUtils.getIp(request);
       log.info(Constants.LOGPRIFIX+"ip:"+ip);
    	return true;
    }

    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    }
}
